# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=hunter
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=3.1.3
pkgrel=1
pkgdesc="Hunter is a flexible code tracing toolkit (mingw-w64)"
arch=('any')
url='https://github.com/ionelmc/python-hunter'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python-colorama"
         "${MINGW_PACKAGE_PREFIX}-python-manhole")
optdepends=("${MINGW_PACKAGE_PREFIX}-gdb: for remote support")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-pip"
             "${MINGW_PACKAGE_PREFIX}-python-wheel"
             "${MINGW_PACKAGE_PREFIX}-cython")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest-benchmark"
              "${MINGW_PACKAGE_PREFIX}-python-pytest-runner"
              #"${MINGW_PACKAGE_PREFIX}-python-process-tests"
              #"${MINGW_PACKAGE_PREFIX}-python-virtualenv"
             )
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz::https://github.com/ionelmc/python-hunter/archive/v$pkgver.tar.gz")
sha512sums=('ea9cc935240526d2942568073cecfb2bef32d7caedd0b370850b208a56c652bf356ba0e5675281946419aafd966cbff148490f6f4439d0d808335a3e831adbf7')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${CARCH} || true
  cp -r "python-${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"  
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
